package org.jeecg.config.api;

import org.jeecg.config.aspct.ApiCheckDataAuthAspct;
import org.jeecg.modules.aspect.ApiLoginAspct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @BelongsProject: jeecg-boot-parent
 * @BelongsPackage: org.jeecg.config.api
 * @Author: mi
 * @CreateTime: 2024-07-12 15:22
 * @Description:
 */
@Configuration
public class ApiConfig implements WebMvcConfigurer {
    @Autowired
    private ApiLoginAspct apiLoginAspct;
    @Autowired
    private ApiCheckDataAuthAspct apiCheckDataAuthAspct;
    @Override
    public  void addInterceptors(InterceptorRegistry registry){
        registry
                .addInterceptor(apiLoginAspct)
                    .addPathPatterns("/api/**")
                    .addPathPatterns("/v1/api/**")
        ;
        registry
                .addInterceptor(apiCheckDataAuthAspct)
                .addPathPatterns("/api/**")
                .addPathPatterns("/v1/api/**")
        ;

    }
}